<template>
    <div>
        <el-row :span="10" style="margin-bottom: 40px;">
            <el-col :span="6">
                <el-card style="color: #409EFF">
                    <div >用户总数</div>
                    <div style="padding: 10px 0 ; text-align: center; font-weight: bold;">76</div>
                </el-card>
            </el-col>
            <el-col :span="6">
                <el-card style="color: #909399">
                    <div >销售总量</div>
                    <div style="padding: 10px 0 ; text-align: center; font-weight: bold;">￥647580</div>
                </el-card>
            </el-col>
            <el-col :span="6">
                <el-card style="color: #67C23A">
                    <div >收益总额</div>
                    <div style="padding: 10px 0 ; text-align: center; font-weight: bold;">￥5640000</div>
                </el-card>
            </el-col>
            <el-col :span="6">
                <el-card style="color: #E6A23C">
                    <div >门店总数</div>
                    <div style="padding: 10px 0 ; text-align: center; font-weight: bold;">25</div>
                </el-card>
            </el-col>
        </el-row>
       <el-row>
        <el-col :span="12">
            <div id="main" style="width: 500px; height: 400px;"></div>
        </el-col>
        <el-col :span="12">
            <div id="pie" style="width: 500px; height: 400px;"></div>
        </el-col>
       </el-row>
    
    </div>
</template>
<script>

import * as echarts from 'echarts'
export default {
    name:"HomeView",
    data(){
        return{

        }
    },
    mounted(){
        var chartDom=document.getElementById('main');
        var myChart=echarts.init(chartDom);
        var option={
            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                data: [150, 230, 224, 218, 135, 147, 260],
                type: 'line'
                }
            ]
        };
        myChart.setOption(option);

        var pieDom=document.getElementById('pie');
        var pieChart=echarts.init(pieDom);
        
        var pieOption = {
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    top: '5%',
                    left: 'center'
                },
                series: [
                    {
                    name: 'Access From',
                    type: 'pie',
                    radius: ['40%', '70%'],
                    avoidLabelOverlap: false,
                    itemStyle: {
                        borderRadius: 10,
                        borderColor: '#fff',
                        borderWidth: 2
                    },
                    label: {
                        show: false,
                        position: 'center'
                    },
                    emphasis: {
                        label: {
                        show: true,
                        fontSize: 40,
                        fontWeight: 'bold'
                        }
                    },
                    labelLine: {
                        show: false
                    },
                    data: [
                        { value: 1048, name: '第一季度' },
                        { value: 735, name: '第二季度' },
                        { value: 580, name: '第三季度' },
                        { value: 484, name: '第四季度' },
                    ]
                    }
                ]
            };
        pieChart.setOption(pieOption);
    }
}
</script>

<style scoped>

</style>
